package com.kly.user.controller.test;

import com.kly.user.dto.AddWlmReq;
import com.kly.user.service.WlmService;
import com.kly.user.task.LikeBackIssueTask;
import com.kly.user.task.WLMIssueTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test1")
public class RelationTestController {

    @Autowired
    private WlmService wlmService;

    @Autowired
    private WLMIssueTask wlmIssueTask;

    @Autowired
    private LikeBackIssueTask likeBackIssueTask;

    @ResponseBody
    @RequestMapping(value = "/like/{from}/{to}")
    public String testLike(@PathVariable String from, @PathVariable String to) {
        AddWlmReq addWlmReq = new AddWlmReq();
        addWlmReq.setUserCode(from);
        addWlmReq.setUserCodeFriend(to);
        addWlmReq.setLikeType(1);
        wlmService.addWlmUser(addWlmReq);
        return "like";
    }


    @ResponseBody
    @RequestMapping(value = "/fc/{from}/{to}")
    public String testFlashChat(@PathVariable String from, @PathVariable String to) {
        AddWlmReq addWlmReq = new AddWlmReq();
        addWlmReq.setUserCode(from);
        addWlmReq.setUserCodeFriend(to);
        addWlmReq.setLikeType(1);
        wlmService.connectByFlashChat(addWlmReq);
        return "fc";
    }

    @ResponseBody
    @RequestMapping(value = "/wlm/{from}/{to}")
    public String testwlm(@PathVariable String from, @PathVariable String to) {
        wlmIssueTask.addUserWlm(from, to,"sparksy");
        return "wlm";
    }

    @ResponseBody
    @RequestMapping(value = "/lb/{from}/{to}")
    public String testlb(@PathVariable String from, @PathVariable String to) {
        likeBackIssueTask.doLikeBack(from, to,"sparksy");
        return "lb";
    }

}
